package cn.dai.service;

import cn.dai.dao.RoleDao;
import cn.dai.pojo.Role;

import java.util.List;

/**
 * @author ArkD42
 * @file RBAC
 * @create 2020 - 06 - 11 - 19:27
 */
public class RoleServiceImpl implements RoleService{

    private RoleDao roleDao;

    public RoleServiceImpl(RoleDao roleDao) {
        this.roleDao = roleDao;
    }

    @Override
    public List<Role> getAllRole() {
        return roleDao.queryRoleList();
    }

    @Override
    public Role getRoleById(Integer id) {
        return roleDao.queryRoleById(id);
    }

    @Override
    public int addRole(Role role) {
        return roleDao.insertRole(role);
    }

    @Override
    public int editRoleById(Role role) {
        return roleDao.updateRoleById(role);
    }

    @Override
    public int delRoleById(Integer id) {
        return roleDao.deleteRoleById(id);
    }
}
